package com.haruhi.entity.vo;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResponseEntity {
    private Integer code;
    private String message;
    private Object data;


    public static ResponseEntity success(Integer code,String message,Object data){
        return new ResponseEntity(code,message,data);
    }
    public static ResponseEntity success(Integer code,String message){
        return ResponseEntity.success(code,message,null);
    }
    public static ResponseEntity success(String message){
        return ResponseEntity.success(0,message,null);
    }
    public static ResponseEntity success(Object data){
        return ResponseEntity.success(0,"OK",data);
    }
    public static ResponseEntity success(String message,Object data){
        return ResponseEntity.success(0,message,data);
    }
    public static ResponseEntity success(Integer code){
        return ResponseEntity.success(code,"OK",null);
    }
    public static ResponseEntity success(){
        return ResponseEntity.success(0,"OK",null);
    }


    public static ResponseEntity fail(Integer code,String message,Object data){
        return new ResponseEntity(code,message,data);
    }
    public static ResponseEntity fail(Integer code,String message){
        return ResponseEntity.success(code,message,null);
    }
    public static ResponseEntity fail(String message){
        return ResponseEntity.success(-1,message,null);
    }
    public static ResponseEntity fail(Object data){
        return ResponseEntity.success(-1,"失败",data);
    }
    public static ResponseEntity fail(Integer code){
        return ResponseEntity.success(code,"失败",null);
    }
    public static ResponseEntity fail(){
        return ResponseEntity.success(-1,"失败",null);
    }

}
